package com.zhu.storesmanager.models;

public class UserData {
    public static final int USERTYPE_SUPERVISOR = 1; //督导
	public static final int USERTYPE_SALESPERSON = 2; //促销员
	public static final int USERTYPE_ADMIN = 3; //管理员

	public int mStatus;			//状态  1:成功; 0：失败
    public String mUuid;			//Uuid
    public String mRealName;		//姓名
    public int mRoleType;		//角色类型 1-GPS督导;2-GPS促销员;3-GPS管理员
    public String mCounterName;	//门店名称
    public int mCounterTarget;	//门店目标
    public boolean isNewUser; //是否新用户
    public boolean isOffline; //是否离线登录
    public boolean isNeedUpdate; //是否需要更新
    public String mUpdateUrl;  //更新地址
    public long mFileSize; //APK大小
    public boolean isShowHistoryData = true; //是否显示历史数据
 
    /**
     * 从登录结果复制数据
     * @param result 登录结果
     */
    public void copyFrom(SyncModel.LoginResult result){
    	mStatus = result.Status;
    	mUuid = result.Data.Uuid;
    	mRealName = result.Data.RealName;
    	mRoleType = result.Data.RoleType;
    	mCounterName = result.Data.CounterName;
    	mCounterTarget = result.Data.CounterTarget;
    	isNeedUpdate = result.Data.Upgrade == 1;
    	mFileSize = result.Data.FileSize;
    	isShowHistoryData = result.Data.ClearCache == 0 ? true : false;
    }

    /**
     * 是否是管理员
     */
    public boolean isAdmin(){
    	return mRoleType == USERTYPE_ADMIN ? true : false;
    }
}
